open(BUFF,"gunzip -c ./final_vcf/final_40.vcf.gz |") or die "no input file found\n";
open(WRBUFF,"| bgzip -c > ./final_vcf/modified_vcf_correct/final_40_type2.vcf.gz") or die "cannot create output file\n";
$sample_field = 10; #genotype field start from column 10
#$format_num_fields = './.:.:.:.'; #number of fields in the format field sep by ':' and assumes first column as GT
$format_num_fields = './.';
while(<BUFF>)
{
	print WRBUFF $_;
	$line = $_;
        if($_ =~ m/^#CHROM\tPOS/)
        {
                last;
        }
}
while(<BUFF>)
{
	chomp($_);
	@array = split(/\t/,$_);
	#print $_."\n";
	for($i=$sample_field-1;$i<@array;$i++)
	{
		if($array[$i] eq '.')
		{
			$array[$i] = $format_num_fields;
		}
	}
	$_ = join("\t",@array);
	print WRBUFF $_."\n";	
	#print $_."\n";
	#die ;
} 
